The difference is the width of the buffer tube. Mil-spec carbine tubes have an outside diameter of 1.146 inches, with there being some slight room for variation—usually no more than a thousandth of an inch. Commercial-spec buffer tubes are larger, with an outer diameter of about 1.17 inches, and a slanted back plate instead of a flat one.
Although the difference is small, it matters, because almost all modern-production AR-15 stocks are designed for mil-spec buffer tubes. Commercial-spec buffer tubes aren't all that common anymore, so there isn't much need to check the buffer tube on a new-production rifle. That said, it's always best to check the manufacturer's manual that comes with the rifle or check the tube yourself with calipers to get an exact answer before buying a stock.