Often this will be caused by the mast pumping in the top third. My C&C 36 did this. You should only notice this in the slip or in very light winds.
The easiest way to correct this is to get a small line with no stretch, connect it to the main halyward, and raise up to within 5 feet of the top of the mast. You will have to play with the height to get the correct setting. The other end of the line needs to be connected to a cleat at the rear of the boat. By changing the halyard tension, you can change the harmonic damper of the rig and end the vibration.