In the face of persecution, Jesus’ followers have two reasons to rejoice and be glad.
First, they know that God rewards those who suffer for their faith, and that their reward will indeed be great in heaven.
The second reason Jesus’ followers can rejoice in tribulation is that they stand in good company: In the same way they persecuted the prophets who were before you, Jesus says.
Jesus’ climax at the end of the Beatitudes says exactly this: Stand faithful and do not get blown about by the ideologies of the world. … If we lose our distinction from the world’s greed, uncaring, self-centeredness, exclusionism, unfaithfulness, and violence, then we have no purpose.