After checking the gun is empty, put it into battery with an empty chamber and grasp the front of the slide in one hand and the grip of the frame in the other and try to push the slide up and down. If that is rattling at all, you don't have tight lock up. Put a 7/16" wood dowel into the muzzle that reaches back to the throat, and with the empty gun in battery and while holding the grip frame, push the barrel up as far as it goes. Next, put your thumb on the back of the barrel through the ejection port and see if you can push it down? If you feel it move, you don't have tight lockup. A tight lockup won't be moved by the dowel and won't let the slide rattle in the frame.
Why this affects accuracy is simply that firm lockup is the only way to assure the sights are in the same position with respect to the barrel axis each time the gun cycles. Without firm lockup the back of the barrel could come up a little higher on one cycle than it does on another, or a little to the left or a little to the right from one cycle to the next. All these change the position of the barrel relative to the sight line. The effect on accuracy is the same as having loose sights that move around a little from one shot to the next.
Common estimates are that getting the barrel lock-up correct gets you 70-80% of all the mechanical accuracy improvement you will achieve. Fitting a tight bushing will get you another 15-20%, while tightening the slide and frame gets you maybe the last 5-10%. That all assumes you have good components and not a badly crowned or throated barrel or one with an oval cross-section (yes, I've seen that) or uneven rifling depth (I've seen that twice; can you spell keyholing?). Perhaps Harry can confirm or add some examples from his experience that widen those ranges, but they match what I've observed well-enough for government work.
But that was just the mechanical precision. The mechanical accuracy is only about half the story. You still have the practical accuracy component. That is comprised of the things that make the gun easier for shooter to use: better sights, better trigger, better grip panels, a grip safety that is more comfortable, parts that produce faster lock time, a square toe firing pin stop or a muzzle brake for reduced muzzle flip, and so on. For many shooters, the practical accuracy improvements constitute roughly half of what is responsible for actual hit improvements on their targets. In the case of speed disciplines with relatively large targets it can be 70% of what improves their score.