This page in the wiki has you covered, I think. The general idea is that if you match the element to the target (corrosive-armor[yellow], fire-flesh[red], shock to shields[blue]) you’re firing at you will empty the health bar faster. Element matching will also have an effect on the potency of the DOT that you may apply. Slag is a multiplier, in NVHM and TVHM it multiplies your damage by 2, and in UVHM it multiplies by 3. I think the numbers in the wiki page I linked are accurate, but I’m confident that there are peeps here (not me ) who know for sure.
Edit: Both impact and splash are affected by the damage multipliers.
VaultHunter101
(So long, and thanks for all the fish)
#8
For way more information than you probably wanted, this page has the complete breakdown of the damage formula and how it works (including a table of elemental resistances at the end):
Note that although it appears in the TPS section, the bulk of it is the same in both TPS and BL2. The only difference is the slag <-> cryo element swap.