This is the beginning of a new part of the story in which Jesus begins to teach his disciples. This part continues through the end of chapter 7 and is frequently called the Sermon on the Mount.
Here "kingdom of heaven" refers to God's rule as king. This phrase is only in the book of Matthew. If possible, keep "heaven" in your translation. AT: "for God in heaven will be their king" (See: [[rc://en/ta/man/translate/figs-metonymy]])
Possible reasons they are sad are 1) the sinfulness of the world or 2) their own sins or 3) the death of someone. Do not specify the reason for mourning unless your language requires it.