USB 3.0 uses 9 pins and USB 2.0 uses 4 pins. A USB 2.0 plug will connect to 4 of the pins of a USB 3.0 jack. A USB 2.0 device can plug into a USB 3.0 jack and a USB 3.0 device can plug into a USB 2.0 jack. Both will operate at 480 Mbs, where as USB 3.0 will operate at 4.8 Gbs.
This is how a USB 2.0 cable can be plugged into a USB 3.0 socket:
Notice how the "square" plug on the end of the USB 2.0 cable fits into just the lower half of the USB 3.0 socket. A USB 3.0 cable has an extra "hump" on the top of the plug that contains more connectors which lets it transfer data more quickly.
The normal full size usb 2 and 3 looks the same but the mini and micro connection are different with extra bits sticking out on usb 3. So a usb 3 mini and micro port can be used with both 2 and 3 cable, however a usb 3 cable with mini or micro connector cannot be used in usb 2 port because the extra hanging bit will not fit.