This article is from the VW Technical FAQ, by with numerous contributions by Jan Vandenbrande others.
A: Too much advance. Check Timing. Also check VALVE timing. Too low gas
octane/too high engine compression. Engine overheating. Carbon build up on
valves. An improperly torqued knock sensor can cause the sensor to not
function correctly resulting in knock and/or loss of power. Failing knock
sensor.
NOTE: Do not mistake engine knock or pinging for other problems. Knock
occurs under load (e.g., accelerating, going up a hill, fast driving).
Knock seldom occurs under no load conditions (e.g., idle or revving the
engine). If you hear a rattle there <NOISE> it may be something else:
valves, bearing, wristpin slap, etc.
 
Continue to: