Initially, pitching up will trade airspeed for altitude. Going from a climb at 300 knots to a climb at 250 knots means pulling back & increasing the rate of climb while the speed decreases.
For a close-in fix to the climb profile, this is often sufficient to rapidly gain several hundred feet above the FMC prediction and solve the situation.
For a steady climb, the slower speed is typically a steeper sustained angle, mainly because the parasite drag goes up with airspeed (and at typical climb speed ranges, parasite drag is the larger contributor to total drag than induced drag is). So for a case when you're many miles from the restriction, the improved climb angle at the lower speed will help you meet the constraint. (Note that this only works to a point, getting slower than the max angle of climb speed, other things come into play & you're then hurting your climb performance. But that Max Angle speed is typically well below normal climb speeds.)
Finally, as a matter of planning, it takes time -- and therefore distance -- to accelerate. Delaying that acceleration until past the constraint can be helpful too. There is a departure out of KBWI with an altitude constraint at or above 11,000' that can be hard to make under certain conditions if you let the FMC accelerate the aircraft from 250 (speed below 10,000') to a fast climb speed (say, 300 knots) before getting very far above 10. The easy solution is to keep the speed at 250 until through 11,000, which makes the restriction easily, and then accelerate.