Check out the Wiki article on /execute for some more info. There's an extra detect part of the syntax that comes into play here that checks only for players with a specified block at a specified location.
execute <target> <x> <y> <z> detect <x> <y> <z> <block damage value> <command...>
Basically what you're looking for is this to put on a clock:
execute @a ~ ~ ~ detect ~ ~-1 ~ mob_spawner 0 give @p diamond
Basically, what this is doing:
- The execute command looks at all players.
- The detect part of the command filters that to only those players who have a monster spawner underneath them.
- The give is obvious.
That ought to be all you need.