Network masks is a notation to group IP addresses. Let's take a familiar analogy. My phone in US was 510-595-3830. 510 was the area code which included a large group of phone numbers in San Francisco-Oakland-Emeryville area. Similarly IP addresses are also grouped by their network prefix.
Netmasks are important for allocating sub-networks to individuals or organizations. They are also used to identify networks for routing purposes.