Two factors matter: the nature of the bonds and the scale of the interactions
The simple case is that, for many giant covalent substances, all the bonds are strong covalent bonds. Diamond, where all the carbons in the substance are connected to each other by strong covalent bonds, is a good example.
The more complex case relates to how strong the weak interactions between individual molecules (van der Waals forces) are in molecules of different size. Iodine, a substance containing small molecules containing two iodine atoms, is volatile because it has weak forces between the molecules. But polyethylene, a polymer is a fairly solid and non volatile substance, contains long strands of alkane-like chains held together by the same forces.
But the strength of those weak forces between the components making up the substance, depend on the surface area of the components. Iodine molecules have a small surface area, so the forces are weak; polyethylene chains have a large surface area, so the attractive forces are strong. This is also why geckos can walk up walls: same forces at play but the structure of their fingers and toes creates huge surface area maximising the overall strength of the weak interactions.
The surface area also explains why the shape of the molecule matters. Compact molecules have smaller forces than their isomers of the same size that are less compact. So the compact 2,2 dimethyl butane (sometimes called neopentane, C(CH3)4) is far more volatile than its isomer pentane, a 5-carbon long chain.