I was asked by a fellow ex-er to explain why Catholicism isn't Pelagian. This is a good question, because it's actually a common claim against Catholicism (despite the fact that it was the Catholic Church who originally rejected Palagianism as heresy!)
So, Pelagianism says that because we have free will, grace is unnecessary, you just have to choose to avoid sin, and do good, and you could theoretically choose never to sin, and so "earn" your salvation. This is your basic "saved by works apart from grace" mentality.
In contrast, Catholics believe all good works are a result of God's grace.
Partly because I'm lazy, and partly because I don't think I can say it better than Mark Shea, I'm going to quote from an article he wrote about merit.
The Second Council of Orange said, "As often as we do good God operates in us and with us, so that we may operate" (canon 9), and "Man does no good except that which God brings about and man performs" (canon 20). In other words, the Church affirms as strongly as Luther, Calvin, and my Evangelical pastor that God's grace is always prior to our good works (or "prevenient," to use theological technobabble).
For Trent, as for Evangelicals, fruit (or its Catholicese equivalent "merit") is always the result, not the initiator, of grace. As Paul said, "We are God's workmanship created in Christ Jesus to do good works" (Eph. 2:10), or, as our Lord said, "If a man remains in me and I in him, he will bear much fruit; apart from me you can do nothing" (John 15:5).
But what happens when we bear much fruit? It is to this question that Trent addresses itself in the passage Martin quoted. Essentially Trent is saying that grace, incarnate in us, has tangible and eternal effects on us and our relationship with God according to our cooperation with it. As in the parable of the sower, the seed of the word bears fruit depending on the kind of reception we give it.
If we freely respond to grace and do good, this changes us and makes us able to respond to more grace, which God seeks to give. (Repeat steps 1 and 2 as necessary till sinner is perfected and glorified.) We indeed bear fruit for eternal life. We indeed are rewarded for what we do. Yet it is all the work of grace.
Lewis says, just like Trent, that grace-induced meritorious actions (there are no other kinds of meritorious actions) lead to an increase of grace, and this fits the biblical witness. It thoroughly illuminates all the biblical language about God's rewards for our good deeds (consider the parables of the talents and of the sheep and the goats), yet it leads us a million miles away from the Pelagian notion that we can put God in our debt. Both Lewis and Rome say (to paraphrase Pascal), "God has instituted not only prayer, but all good deeds in order to lend his creatures the dignity of being causes."
I'll end with a quick note on semi-pelagianism, which says that man can make the first move towards God, so to speak, he can, by his own will alone have faith and then God will increase it, even though ultimate salvation can not be obtained without grace (as Pelagianism holds). The Catholic Church believes grace always precedes faith, one cannot have faith without first receiving grace.
More about that here.
On a related note, here is a wonderful article by Jimmy Akin about Righteousness and Merit.
Hope that helps!