What is difference between .\, (local), localhost, and computername in windows?

"localhost" will not work when you'll try to access SQL server from another computer because it pointing to 127.0.0.1. "yourcomputername" should work if both computers (client and server) located in one workgroup/domain.