'04 Ranger received the "Super Duty" grill.
The quick answer, as per previous posters, is: No, you can't just swap grills. You also need to swap the hood and maybe a couple of the front valance pieces.
Bumper are probably close enough for practical purposes - there are more differences between options - XL, XLT, Sport, Edge, FX4, Tremor, most of which has with/without fog light sub options than between years; the lights are same.
98 - 00 are identical.
01 - 03 are identical - Compared with older trucks, the headlight/turn signals changed which change the valance and the grill. And there are more options for hoods i.e Edge
04 - 11 are identical. Super duty grill and matching hood. There are subtle differences - see bumpers but for the most part you can swap with no one being the wiser.