When you eventually make withdrawals from a traditional defined contribution plan, you'll have to pay regular income taxes on the money you withdraw - whether the money came from your contributions, dividends or capital gains.
For traditional plans you will owe income tax on all your withdrawals - both the money you contributed and the gains on your contributions. Remember: Money you withdraw from a defined contribution plan is always taxed at your income tax rate at the time you withdraw it. (The current top income tax rate is 35%, though it's possible that the rate could be changed down the road.)
In the case of a Roth 401(k), you will have to pay tax on your contributions, but you won't be taxed later when you make withdrawals.