My understanding is that Xin Chào is the polite or formal way to say hello and goodbye. Most Vietnamese just say Chào Anh, Chị, Em...etc. However, Tạm biệt is used when you are seeing someone off. Like when family or friends are going away for a long time and you don't know when you will see them again. This was explained to me by several good Vietnamese friends.