I am nearsighted and often find it interesting to learn what people think about it. Not about me.
I have gotten a lot of interesting replies, but seldom one that really understands the subject (unless they themselves are near sighted).
The cornea and the lens of eye work together to focus Light into the back of the eye (a bit like the projector thingies that you can hang from ceilings to display images in a white canvas a bit further away), where the images from the outside will be "developed" (where you have the cells that help make sense of what you are seeing and transmit the info to the brain).
When you are nearsighted the lens shape is a bit off, so the whole light conduction to the back is a bit fuzzy.
When you squint you change the shape of the lens (with all the muscle pressure) just enough to improve the vision a little bit. Your pupil gets bigger and smaller to let in more or less light.
When your pupil is big, light from a single point in the real world is entering the eye at slightly different angles. The eye focuses the light from these slightly different angles back into a single point to make a sharp, clear image. But if you're nearsighted and aren't wearing glasses, light from far away won't be in focus. Instead of the light focusing to a point, it hits your retina (the part of the eye that senses the light) in a circle shape. Because of this, you see a blurry image.
When you squint, you're blocking part of your pupil with your eyelids and eyelashes. Everything looks darker, but the light isn't spread out as much on your retina.
If you take a camera and set the aperture (the camera's pupil) to be big, you'll notice that only a small part of the image is in focus, and everything else is blurry. Now if you close the aperture to make it smaller, a lot more of the image looks sharp. This is for the same reason. Unfortunately you can't control your eye's pupil size - which is why we have to squint to achieve this effect.
Interestingly, if you look at a bright small light in a photo taken with a wide aperature, you can sometimes see big blurry circles or hexagonal shapes where the light was.
This shows the shape of the aperture and how much the light from a point spreads out on the camera's light sensor. Therefore, short lenses (a pinhole) provide very clear focus, while tall lenses (your normal eye) provide a much shorter focal distance.
If your eyes are having trouble focusing, it can make a big difference.