According to SEDS, a shepherd satellite is "a satellite which constrains the extent of a planetary ring through gravitational forces." These moons have the effect of keeping the rings very sharply defined. Without these moons, rings would tend to spread indefinitely. The moons have to be of a specific mass and distance relative to the ring for this phenomenon to occur.
This shepherding theory was proposed in 1979 by Peter Goldreich and Scott Tremaine to explain why Uranus's rings were so narrow. Since that time, observations of Saturn and Uranus have shown several examples of shepherding, including Cordelia and Ophelia for Uranus and Pandora and Prometheus for Saturn.
The shepherding effect is believed to be caused by the fast inner moon accelerating particles in the ring causing them to move into higher orbits. The slower outer moon has the opposite effect, decelerating particles and causing them to move into lower orbits. The net effect is a sharply defined narrow ring.
Here is a more precise description of the process from space.com with lots of polysyllabic words that may impress people at parties:
"At certain radii, termed resonances, in which the satellite's orbital period is a whole number ratio of the ring particles' orbital period, the satellite exerts a net torque on the ring by gravitational interaction. As the satellite and ring exchange angular momentum, energy is dissipated by collisions among the ring particles. The outcome of this interaction is that the satellite and ring repel each other. The one in the outer orbit moves outward, and the one in the inner orbit moves inward. Since the satellite is much more massive than the ring, it prevents the ring from spreading across the radius at which resonance occurs."