Hosts with the same host name but different SSH ports?

Yes. You can give them named aliases in resolv.conf and name them in
the inventory file like this:

[somegroup]
foo ansible_ssh_port=1234
bar ansible_ssh_port=1235

I was hoping that there is a way to do this without editing system config (like resolve.conf)

May be in some future version we may have something like this:

[somegroup]
foo ansible_ssh_port=1234
bar ansible_ssh_port=1235 real_host_name=foo

well sure.

There are two things that should be supported actually

ansible_ssh_user -- overrides an user at the connection plugin level

ansible_ssh_host -- overrides the host name at the connect plugin level

This needs to be done for both paramiko and SSH connection types and
I'll take a patch.