This noise generally is heard when the engine is under load, such as when accelarating or climbing a hill. While it often may be caused by a tankfu of inferior gas, ignition knock frequently is a sign your engine needs attention. I also can be caused by build up of carbon inside the engine.
Late model cars are equipped with a knock sensor which “hears” the sound and makes corrective adjustments. But it cannot compensate for a severe malfunction, a condition which can affect engine performance, even damage the engine.l