Huge Spoilers past this point for any of the readers that haven't seen the Flash yet.
If I remember correctly, Barry travels back in time to stop Thawne from murdering his Mother and framing his father for her death in the finale of S2. This event completely changes the time-stream and creates Flashpoint. An alternate time-line where Barry still has his family intact.
Barry has memories from both time-lines. He remembers every birthday that he spent with his parents, and also every birthday he spent with Joe and Iris. Barry has Thawne captured and is holding him in a cell that he cannot escape from.
Half-way through the season Barry starts losing his speed and his memories from the first time-line. I'm not a writer of the show so I can't say for sure what their thought process was, but I can guess.
Barry starts losing himself.
Thawne inadvertently helps Barry realize that he lost more in the first time-line than he gained in this new one. Barry watches as his brother almost gets killed right in front of him and that really hits Barry hard. He realizes that saving his mom changed everyone, and he realizes how selfish he was being when he did that. He runs back in time to stop himself and succeeds. Barry jumps back into the future and realizes that everything is not as it once was in the first time-line. This is when Barry FINALLY learns some responsibility with time-travel and stops screwing around with it.
NOTE: I haven't seen S3 in a long time. So correct me if I am wrong.