Possibly a plugged catalyst - causing high exhaust backpressure.

With high backpressure the hot exhaust gas gets trapped in the cylinder, and lowers the threshold for pre-ignition, or pinging - possibly the rattling noise you hear.

Makes sense too that when the engine is loaded (ie. going up hills) it would be worse, as the exhaust temperatures raise when the engine is under a load, and the pre-ignition would be exacerbated.