Normally a M sized creature can only attack opponents in its 3 front spaces. Some weapons (like polearms) have a range that can extend this and allow attacks further away, and there are some weapons (lances and pikes specifically) that are classified as range only, meaning they cannot hit targets that are only 1 square away.
Range 1 (standard): 3 front squares
Range 2: 3 front squares + 5 squares in next rank
Range 3: 3 front squares + 5 squares in next rank + 7 squares in next rank
Larger than M sized Creatures:
Large size creatures add 1 to their weapon’s range, Huge add 2, and Gargantuan add 3
Some creatures may also have extended reach with their natural weapons