This refers to a defensive player (usually a linebacker or defensive back) whose sole responsibility is to shadow the quarterback. Typically the defensive player floats just off the line of scrimmage, if the quarterback rolls left, he rolls left. If the quarterback runs with the ball, he follows. A spy is mostly used on a dual threat quarterback as opposed to a pocket passer.
This differs from a "QB contain" strategy where the goal is to keep the quarterback from getting outside. In spying it involves a single player who watches the quarterback from behind the line of scrimmage. It can be a risky strategy because you're taking 1 of your 11 players to mirror the quarterback as opposed to helping with pass coverage or stopping the run.