It is as easy as adding a new item to the keychain.
For example, if you have a domain domain.tld and a subdomain sub.domain.tld, you can follow these steps to add 2 valid passwords that get used when you login to the respective sites:
Login to domain.tld and choose "save password" when login
Repeat for sub.domain.tld and again choose to "save password" when login
Manually open the keychain and ensure that the distinct passwords have been saved for each item
If the same password was saved for both just change the items adequately (edit them and save)
You can now successfully login to both items without hassle.
Additionally there will also be a "other passwords of this site" which further allows you to pick the right password when login
But it is not required, I use this daily on a ton of sites and the only thing I always need to do is (once) make sure the correct password got saved for the correct item.
After that once manual edit, you're good to go.
Hope that helps,
Beda.