How can I associate localhost in Snow Leopard to a specific ip?
You don't want to do this. As you pointed out, there are warnigs in the /etc/hosts file not to change the localhost entry.

The localhost entry is meant to resolve to the local host and more specifically the loopback address 127.0.0.1. On your Snow Leopard machine, localhost should resolve to your Snow Leopard machine and on your Ubuntu machine, localhost should resolve to your Ubuntu machine.

If you are trying to access the Ubuntu system from your Snow Leopard system, why don't you just use the IP address of the Ubuntu system?