The attack on the police position was close to an area where some 200,000 people had gathered for a prayer service in Kishoreganj town, about 140 km (90 miles) northeast of the capital, Dhaka, said district administrator Zillur Rahman.
Two of the attackers were killed, Rahman said.
The militants attacked police with "sharp weapons" after the grenades exploded, said Mohammad Azimuddin Sheikh, another senior district official.
Rahman said the attack had been brought under control.
"We are still checking for other miscreants but after this incident prayers were held peacefully and we have asked everyone to go home," Rahman said.
The violence rattled nerves less than a week after militants killed 20 people, mostly foreigners, in an attack on a cafe in the capital claimed by the Islamic State militant group.
It was one of the deadliest attacks ever in Bangladesh, where al Qaeda and Islamic State have made competing claims for a series of killings of liberals and members of religious minorities in the past year.
The government has dismissed those announcements and insists that the violence is homegrown.
After last week's attack, Islamic State warned that the violence would continue until Islamic law was established worldwide, saying in a video that the Dhaka assault was just a hint of what was to come.
Ramadan ended this week with the Eid al-Fitr festival across the Muslim world.