Both Peter and Anne don't get along well with their mothers mostly because of the generation gap which separates mothers from teenagers. Peter is embarrassed by his mother because she flirts with Mr. Frank and fights with his father in front of everyone. Further, Mrs. Van Daan makes fun of Peter and Anne's relationship, which also embarrasses him. This causes Peter to withdraw from his mother's company and not share any private thoughts or feelings with her.
Anne, on the other hand, doesn't appreciate her mother because she feels as though Mrs. Frank still treats her like a baby. She tells Anne when it is time to have her milk, for example. She also gets after Anne about her behavior and behaving the way Margot behaves. Comparing siblings to each other is never a good way to parent because it only makes one feel resentful towards the parent and the other sibling--which is the case for Anne. As a result, Anne also withdraws from her mother and either seeks guidance from her father, comfort with her diary, or friendship with Peter.
The unstable relationships between these mothers and their children become a topic that helps Anne and Peter to bond on a more friendly level. In fact, it is a conversation about their frustrations with their mothers that leads Anne to say the following in act 2:
"Isn't it funny, you and I? Here we've been seeing each other every minute for almost a year and a half, and this is the first time we've ever really talked. It helps a lot to have someone to talk to, don't you think? It helps you let off steam."
Had Peter and Anne talked about the similar feelings they share about their mothers before, they may have found comfort in friendship long beforehand.