I've always been a bit perplexed about the second beatitude ('Blessed are those who mourn, for they will be comforted'), but John Stott's comments are illuminating.
One might almost translate this second beatitude 'Happy are the unhappy' in order to draw attention to the startling paradox which it contains. . . . [T]hose here promised comfort are not primarily those who mourn the loss of a loved one, but those who mourn the loss of their innocence, their righteousness, their self-esteem. It is not the sorrow of bereavement to which Christ refers, but the sorrow of repentance.
--The Message of the Sermon on the Mount (BST; InterVarsity, 12978), 40-41