While there is an endless variety of sizes and shapes of electrical boxes, all can be divided into either plastic or metal electrical boxes.
Plastic Electrical BoxUse only with Romex or NM wiring. Do not use with metal-sheathed or "BX" wiring.
Metal-sheathed wiring depends on the conductivity of the metal electrical box for grounding. Using metal-sheathed wiring with plastic electrical boxes in highly dangerous.
Easy for do-it-yourself home renovators to work with, plastic electrical boxes either come with pre-attached nails for nailing into studs or with "wings" so they can be attached in a cavity cut into drywall. Common single size (rectangular) is used for receptacles and light switches.
Metal Electrical BoxPrimarily used with metal-sheathed or "BX" wiring. However, can also be used with Romex or NM wiring wiring, if desired.
The metal electrical box is best suited for metal-sheathed wiring. This type of wiring depends on the contact between its metal sheathing and the metal box to complete grounding. However, NM or Romex wiring does not use its sheathing for grounding: it uses a bare wire contained within the sheathing. As such, Romex or NM wiring can be used either metal electrical boxes or plastic electrical boxes.