Le'ts say you're trying to write a letter to your Grandfather.
If he's your boss. It' should be FORMAL. If he's just your grandfather and he's sick -----> Friendly!
So it's not about memorizing words: neighbour boss colleague supervisor....
If you're just a student -------> formal letter-------->Supervisor
If your supervisor is your girlfriend---------> Informal
Your Colleague --------> Can be both: if your relationship is confined to the workplace ----------> Formal
But, if you're going to ask her/him a favour, or want to hang out ---------------> Informal