In a medium bowl, season the flour with salt and pepper. Add the okra and toss to coat.
In a large skillet, melt 1 tablespoon butter over medium-high heat. Add the okra and cook, stirring occasionally, until golden, 3 to 5 minutes. Transfer the okra to a plate and reserve the skillet.
In a small saucepan, bring 3 cups water to a boil. Stir in the grits, lower the heat, cover and simmer until thickened, about 7 minutes. Stir in 4 tablespoons butter; season with salt and pepper.
Meanwhile, in the reserved skillet, melt the remaining 1 tablespoon butter over medium-high heat. Add the onion and bell pepper and cook, stirring, until browned, about 10 minutes. Stir in the tomatoes and cayenne. Bring to a boil and cook, stirring, until the mixture is slightly reduced, about 5 minutes. Lower the heat to medium, add the shrimp and simmer until the shrimp are just cooked, about 3 minutes. Stir in the okra and season with salt and pepper. Serve over the grits.