What makes people squint when they can't see something?

Better focus. Squinting creates a "pinhole" effect that results in clearer vision by eliminating what is referred to as diffractive light rays entering your eye and not focusing on your retina. By squinting, these diffractive light rays are condensed and they come closer to landing at the proper place on your retina resulting in clearer vision.