Every mazda I have had (3 3's, 3 5's) will all dim the headlights when you roll up and down the windows as the electrical system is so lean the sudden loss of power isnt recovered for a second or two. If its severe where its even effecting your dash then its possibly a bad battery\alternator. Usually things act a little wierd (guages and such) when the alternator is losing it. Unless your motor is actually dying or making odd noises where you think its severe I wouldnt worry about it. Our mazda's arent as beafy as the fords ive had (mustangs and tbirds) where the lights wont even dim, and if they do its literally just a tiny flicker you dont notice.