The understanding I have of merit in Catholic teaching I've discovered so far is this:
1. The works are meritous because they are works of Christ through us (The body of Christ) just as his work on the cross is the meritorious cause of our salvation (Council of Trent)
2. The works are meritous because of the overwhelming mercy of God, in that as a loving father he judges them valuable despite their littleness.
"My merit comes from his mercy; for I do not lack merit so long as he does not lack pity. And if the Lord's mercies are many, then I am rich in merits. For even if I am aware of many sins, what does it matter? Where sin abounded grace has overflowed. And if the Lord's mercies are from all ages for ever, I too will sing of the mercies of the Lord for ever. Will I not sing of my own righteousness? No, Lord, I shall be mindful only of your justice. Yet that too is my own; for God has made you my righteousness." - St. Bernard of Clairvaux
The ending "you my righteousness" will probably spark claims of proto-protestantism but the Catholic Encyclopedia reminds us: "It is a defined article of the Catholic Faith that man before, in, and after justification derives his whole capability of meriting and satisfying, as well as his actual merits and satisfactions, solely from the infinite treasure of merits which Christ gained for us on the Cross (cf. Council of Trent, Sess. VI, cap. xvi; Sess. XIV, cap. viii)."
Likewise in Pope John XXIII's writings he says: "The sense of my own littleness and nothingness has always been my good companion, keeping me humble and calm, and making me employ myself to the best of my ability in a constant exercise of obedience and charity for souls and for the interests of the Kingdom of Jesus, my Lord and my all. To Him be all glory; for me and for my merit. His mercy. This alone is enough for me."
St. Thomas More in his dialogue on comfort also says:
"Like as we grant them (Protestants) that no good work of man is rewardable in heaven of his own nature, but through the goodness of God, that list to set so high a price upon so poor a thing, and that this price God setteth through Christ's passion, and for that also they be his own works with us (for good works to God-ward worketh no man, without God work in him); and as we grant them also that no man may be proud of his works for his own imperfect working; and for that in all that man may do he can do no good, but is a servant unprofitable and doth but his bare duty..." [St. Thomas More, A DIALOGUE OF COMFORT, I, 12]
Some reading might think, well isn't this pretty much the same as Protestantism? Not really, it is similar to Wesleyanism but traditional Protestant Theology denies the ability of man to cooperate in any meritous way with God's grace. This is the Protestant idea known as Monergism (God does everything we do nothing), the Catholic idea is Synergism (God does everything we assent to it or cooperate with it). Thus there is a divide.
So while we can really merit because of what Christ has done on the Cross and is doing in our lives, let us not forget to trust humbly in his mercy rather than in our efforts. His mercies make our merits.