If you've got something with very uniform levels in the first place a compressor might be just find for adding or removing transients. But if you've got something like a percussion loop with say loud kicks and snares and quiet hats then a single compressor probably won't work at all.
So you could try this messed up idea ...
1. Squash the life out of your loop with a compressor, real fast attack quite fast decay, high ratio,
2. get another compressor and use it to put attacks back on the sounds
3. Use an expander (some gate plugins will do this) and drive it with a side chain from the original signal and use it to put the dynamics back.
... i've never used the 3rd step in anger yet. Reaktor might be a good tool for building this thing, might give it a go tomorrow or something because i've been wondering how those transient designer things worked for a while ...
and there's a waves plugin in the transform bundle that i have heard that's prety impressive on drum loops ... probably works on some synth parts pretty well too..