Preheat the oven to 400. Whisk together the beer and maple syrup in a 2-quart casserole dish. Add the onion, 4 cloves garlic and 2 sprigs rosemary to the beer mixture; season with salt and pepper. Arrange the chicken skin-side up on top and season with salt and pepper. Cover the dish with foil and set it on a baking sheet. Bake until the chicken is just cooked through, or until a thermometer inserted into the thickest part reaches 145, about 40 minutes.
Meanwhile, combine the olive oil with the remaining 4 cloves garlic and 2 sprigs rosemary in a small saucepan; warm over low heat until the garlic is soft and the oil becomes fragrant, about 15 minutes.
Using a slotted spoon or tongs, transfer the baked chicken breasts and onion to a plate. Discard the rosemary and garlic; pour the remaining cooking liquid into a skillet and bring to a boil over high heat; cook until reduced by half. Whisk the flour into the liquid, followed by the butter; continue simmering until the sauce coats the back of a spoon, about 4 more minutes. Season with salt and keep warm.
Heat a grill pan over medium-high heat. Brush some of the flavored oil over the chicken; place skin-side down in the pan and grill until golden and crisp, about 3 minutes per side. Transfer to a platter. Toss the onion in the remaining flavored oil and grill until slightly crisp and charred, about 5 minutes. Spoon the grilled onion and sauce on top of the chicken.