The fourth and eighth beatitudes both speak of righteousness, but in two very different ways. The Greek word translated as righteousness in both of these beatitudes is dikaiosynē. In the context in which this word is used, it basically means meeting God's standards through adherence to God's laws. It means doing what is right in the eyes of God so that we can be in a proper relationship with Him.
Righteousness should be the goal of all believers. In Matthew 6:33, Jesus says that we should seek God's kingdom and His righteousness above all of the other needs or desires we may have. In the fourth beatitude (Matthew 5:6), Jesus tells us that those who hunger and thirst for righteousness are blessed because they will be filled. Jesus makes it clear that the pursuit of righteousness is important in the life of all believers.
In his first letter to Timothy, the apostle Paul tells Timothy that he must flee the things that can cause him to waver in his faith. Instead, he is directed to pursue godly virtues, the first of which is righteousness (1 Timothy 6:11). Paul reminds Timothy of this in 2 Timothy 2:22, telling him that he must flee the evil desires of youth and pursue righteousness, as well as other godly virtues. The apostle Peter also wrote of the need to seek righteousness, telling us that Jesus gave His life for us so that we can turn from our sins and live for righteousness (1 Peter 2:24).
God desires that believers actively seek His righteousness, that we hunger and thirst for it. And Jesus has promised us that, when we do, we will not just receive righteousness, but we will be filled to satisfaction with it. Righteousness brings us into harmony with God as we, through the power of the Holy Spirit, live our lives in order to meet His standards and not those of the world. But, there is a cost to living this way. While God rejoices in it, the world does not.
In the eighth beatitude (Matthew 5:10), Jesus speaks of those who are persecuted for the sake of righteousness. He says that those who experience persecution because they choose to live righteously, in harmony with God's Word, are also blessed. In the world, those who live according to His Word may be rejected and criticized, and in some cases, even face physical persecution. But they are to rejoice and be happy because they will be blessed by God. Their joy comes from knowing that Jesus has promised the reward of the kingdom of Heaven, eternity spent in the presence of our loving and faithful God. Righteousness comes with a cost, but the end result, the kingdom of Heaven, is well worth the cost. And that is something to be happy and blessed about!