Ukraine international Oleksandr Zinchenko was made captain for the game by City. He and Peterborough's captain held the Ukrainian flag on the field before kickoff and a message on the big screen inside the stadium read "We Stand With Ukraine" in reference to the invasion of the country by Russia.
City struggled to break down the second tier's bottom club until Mahrez put them ahead on the hour and then Pep Guardiola's side doubled their lead with a goal of prime quality.
Phil Foden struck a ball from deep, which Grealish brought down with a sublime touch before a clinical finish for his first goal in the FA Cup.
Grealish and Foden sat next to each other on the team bus on the way to the game against Peterborough and scrolled through videos of Lionel Messi to fill the time.
"After scoring," Grealish said, "[Foden] came up to me and said it was just like we were watching."