I never understood why Mary disliked Edith so much. It is not as if Edith was the 'pretty one.'
That's just how it goes in families. There doesn't have to be a reason. It's just something baked in as children and then reinforced by actions and behaviors over the years.
The impression I got from the series over the years is that Edith was resentful of Mary because she was the oldest one and one of the two that Robert and Cora lavished their attention on. (The other, of course, being Sybil.) She was the neglected and attention-starved middle child, she was in sort of an "emotional cold war" with Mary prior to the
Titanic's sinking, and after the death of Patrick (whom Mary was engaged to but who Edith was infatuated with) it all sort of broke out into the open. And for Mary, enduring this allowed her to develop into an easy dislike of Edith, who had probably never been anything but resentful toward her -- at least until the point where the Mary-Edith tension becomes one-sided because Edith simply stops caring about being a snot to Mary. I put that around the end of World War I and Edith's jilted wedding to Anthony Strallan. At that point, Edith seems to realize that a life in the country, competing with Mary, simply isn't in the cards for her, so she stops trying and decides to do something else and find her own direction.
I also feel that Edith's growing detachment from Downton as she develops a life separate from the family (her relationship with Michael Gregson, her ownership of the magazine) was a problem for Mary, though for reasons she wouldn't be able to articulate. If asked about these things, Mary would say, "Good for Edith," in her arch way, masking some very real insecurities on her part. Mary was basically raised to marry the Crawley heir and inherit the estate; the idea of a life outside of Yorkshire was alien to her. Edith, as the middle child of a landed family, didn't have the same expectations, so she was better positioned for a cosmopolitan lifestyle. Mary, for all of her interest in modernizing the estate, couldn't let the estate and its past go, while Edith could and did. In later seasons, Mary is sometimes sarcastic about Edith's life and career in London, which I see as a manifestation of Mary's issues with Edith moving on from the estate. I also think that's why Mary doesn't understand why Edith shows up at her wedding; for Mary, Downton is everything and she sees Edith as having turned her back on Downton, without understanding that, for Edith, having a life outside of Downton doesn't mean that Downton and family are unimportant. The irony of the finale is that Edith marries into a life like the one Mary always dreamed of, and doing what's required of
that life may make leading the life Edith had difficult.