In networking localhost just refers to the local machine, whatever it is.
But, generally, the term is used to refer to the local machine as the server, when pointing a web browser to a web server.
You need to have something like Apache installed on the PC that you want the Arduino to send data to. Apache, PHP, and MySQL play well together, and are collectively referred to as LAMP (for Linux) or WAMP (for Windoze). I'm not sure what the equivalent is for the Mac, being a Mac owner for less than 24 hours.
The Arduino will not be accessing localhost, though. Your web server has a name that it is referred to by when being accessed from other devices on the network.
Personally, I think you should forget about the Arduino for a while. When you can get another PC to access a script on your server, and send it data/get data from it, then you can make the Arduino do the same thing. By then, the whole client/server architecture will be a lot clearer to you, and you will be able to ask questions using proper terms. You'll fully understand the scope of "localhost".
Of course, the first step is to understand how a client accesses a script on the server. This is far easier to understand, develop, and debug when the client and server are running on the same machine, known as localhost. When a client, running on the server, can access a script, even if the script is nothing more than a "Hello world" type example (no dynamic content), then learn how to access that server/script from another machine (not localhost any more).
Then, move on to getting dynamic content. Then, sending data to the server to store.
When that all works, from two PCs on the same local area network, you can get the Arduino to do the same thing as the PC client, if it is wearing an ethernet shield and is part of the same local area network.