What difference would barrel length make? Most BB gun barrels aren't rifled, and that's the only thing I can think of that would make a longer barrel more accurate.
Being rifled imparts spin to a bullet, being long compared to the length of the bullet gives you the ability to align the barrel with the target. The shorter the barrel the bigger the chance of mis-alignment.
Barrels were long before they got rifled. Rifling is mostly to keep a bullet on its trajectory once it leaves the barrel, it doesn't do much good if you can't aim the gun.
A longer barrel definitely makes it easier to do this though.