Uh-huh. So tell me, do you even know what a ping is?
A ping, my friend, is a small packet that's sent to the server, to which the server replies back. Your machine then calculates, based on the difference between the time when the ping was sent and the reply was recieved, the time it takes to make a transaction of a packet between itself and the server.
Obviously, a higher ping means your machine takes longer to reach the server, and thus you lag more proemminently. A lower ping means the transaction is quicker, and the lag is minimal.