Click here for an explanation.
The 4 is a number that refers to the major diameter (#4 = 0.1120 in);
The 40 is the number of threads per inch (UNC is typically used).
The remaining fraction (5/16" in your case) is a reference to the length of screw. Note that for cap and button heads this dimension does not include the head, but will for those that have a countersink.
Hope that helps