Let's say that you owned a small company and you "bought" a range of IP addresses from the local internet service provider.
Assuming that the IP addresses you were given is from 100.100.100.0 to 100.100.100.255. In this case, you can only specify your subnet mask at the last group, because the first three groups are fixed by your local internet service provider.
Zero in on the last group, you will notice that there are 8 digits for you to play with, from 00000000 to 11111111.
So, lets say you have 100 computers in your company, which you intend to group into 10 smaller groups. Subnet mask will allow you to achieve it since it can "masked" off certain numbers of the IP address. Going by the example, you will need to allocate up to 4 digits off your 8 digits to be able to accomodate the 10 groups.
Simply put, this means that your IP is spilt into
0000-0000
MMMM-AAAA
where M is for the Mask, and A is for the computer's individual address.
Thus, you will have the following addresses for your company below.
Group 1 Group 2 Group 3
0001-0001 0010-0001 0011-0001
0001-0010 0010-0010 0011-0010
0001-0011 0010-0011 0011-0011
0001-0100 0010-0100 0011-0100
0001-0101 0010-0101 0011-0101
0001-0110 0010-0110 0011-0110
0001-0111 0010-0111 0011-0111
0001-1000 0010-1000 0011-1000
0001-1001 0010-1001 0011-1001
0001-1010 0010-1010 0011-1010
And so forth.
So, if I want to call on Group 3, my subnet mask will be
01100100.01100100.01100100.0011-0000 (100.100.100.4

Similarly, for Group 4, my subnet mask will be
01100100.01100100.01100100.0100-0000 (100.100.100.64)
Get the picture?
So, to answer your first question. Yes, I can define my own subnet mask, if need to.