Preheat the oven to 350°F (180°C).
Butter or spray a rectangular 8x12 inch (20x30 cm) cake pan lined with parchment paper. See Notes below for variations.
Chop the chocolate and put it in a medium bowl with the cocoa powder.
Heat the beer in a medium saucepan over medium heat until it almost boils. Don't let it boil. Add to the chocolate and let stand 1 minute.
Whisk carefully until the chocolate is completely melted and the mixture is smooth. Add the milk and mix. Reserve.
Beat the soft butter in a large mixing bowl with an electric mixer, or in the bowl of a stand mixer with the paddle attachment, at medium speed for 30 seconds.
Add sugars gradually, beating for 3 minutes, until light-colored and fluffy, and scraping the sides of the bowl frequently.
Add the eggs, one at a time, mixing well each time.
Add the vanilla and mix well, scraping down the sides.
Sift the dry ingredients (you can do it in a different bowl or have them measured and sift directly over the butter mixture), and add them in 3 parts, alternating with the Guinness mixture in 2 parts, mixing well but just until it's incorporated. You start and end with the flour mixture. Don't be tempted to beat too much at this point as it will make the cake tougher.
Pour the batter into the prepared pan and bake for about 40 minutes, until a cake tester or toothpick inserted in the center comes out clean. The time might vary depending on the pan and oven.
Let the cake cool completely on a wire rack (cooling rack).