Capacitors and motors
The other two people who have answered have the first part right: the small-value ceramic capacitor acts as a high frequency filter. The brushes create insane amounts of broad-spectrum high frequency noise and this can interfere with the electronics (especially the radio receiver).  The capacitor acts as a short-circuit at high frequencies (Xc = 1/(2*pi*fC)) and it is soldered as close as possible to the commutator (i.e. right at the motor leads) to minimize the "antenna" these frequencies see. If the capacitor was not there the noise would "see" several inches of motor lead which would act as a great little antenna for broadcasting this noise into anything nearby, especially the sensitive radio receiver.

It has nothing to do with smoothing over anything -- the capacitor is far too small to be effective as a temporary storage device. It's being used as a frequency-selective low-impedance shunt, a low-pass filter, if you will.