The term localhost refers to the computer that a program is running on.
If for example you setup and run a web application server on your computer, it is considered as localhost. The localhost has an IP address of 127.0.0.1. This is also referred as a "loopback" address because the information sent to it is routed back to the local machine.
A common use of the localhost address is when a programming language (e.g. PHP) connects to the database server that runs on the exact same machine as the web application server. Since it is the same, the address of the database server is localhost.