It certainly helps, but on occasion some couples can be as different as day and night and get along if they are mature enough. Couples need to give each other head space anyway, so each person should be an individual in their own right. As far as religion it depends on what faith you are. Jewish people prefer to stay within their own faith as do some Catholics, Muslims, etc. If you are a Christian then one can choose a person of another faith or lack of it and still get along. My husband and I are of two different belief systems and we respect each other and have been married 34 years without problems regarding religion.
In my opinion, it's the little things in common that make a relationship like favorite food or favorite movies. Also having the same morals are a good thing. However having the same personality can SOMETIMES be a bad thing. The saying "opposites attract" has a lot of meaning. The other person should complete you. So shy/outgoing for instance could be a good mix. You use your differences in personalities to support eachother.