A subnet mask is the same basic thing as a netmask with the only real difference being that you are breaking a larger organizational network into smaller parts, and each smaller section will use a different set of address numbers.
The subnet that the computer is on is determined by the netmask and IP address of the computer. Therefore the netmask is very important in determining how network traffic is routed from the computer.
When the netmask is setup, it is a number where some of the most significant bits have a 1's value and the rest have values of 0. The most significant part of the netmask with bits set to 1's specifies the network address, and the lower part of the address will specify the host address.
When information is sent across a network a destination IP address is specified. The computer looks at the part of the IP address that matches the part of the netmask where the bits are set to ones. This is the most significant part. If the subnet of the destination address is the same as the subnet of the local computer, the packet is sent out on the network to the destination address. If there is not a match, the packet is sent to the default gateway specified in the network setting.