Unless there is some loose change dropped into the gear selector slots, it could be a shifter bushing.
Mine wore out a couple of years ago on my 300E, but it had an annoying "squeak", rather than a rattle...
2009 ML350 (84K) - Family vehicle
2001 CLK430 Cabriolet (71K) - Wife's car
2005 BMW 645CI (124K) - My daily driver
2012 Mustang V6 (60K) - Daughter's car