This is a good observation that you make. Of course, towards the beginning of the diary, the state of the relationship that Anne has with her elder sister and her parents is explored, and it is made clear that she feels her parents favour Margot as "just the prettiest, sweetest, most beautiful girl in the world." She feels they always take her part and are quick to judge Anne unfavourably. She feels much closer with her father, and believes her mother always supports Margot.
However, as the diary moves on to record the Frank's time in their hiding place and the many struggles that they face, in particular with living in such a claustraphobic atmosphere, it is clear that the relationship improves between the two sisters, perhaps because of the way that Anne is able to process her feelings and her struggles through the use of her diary. This certainly helps her to understand more about herself and her relationships with others. In addition, given the nature of the family and the way that they were trapped together, Anne and Margot really had to get on or make life intolerable for everybody else.