Formal dinners are still common in the armed forces, at some universities and in the Inns of Court. They are usually bound up in ritual and tradition and can therefore be daunting for the uninitiated.
It is the responsibility of the person who has invited you to brief you on what you should expect. If you are doing the inviting be as helpful as possible; your guest may be unused to such formal or official events.
You should arrive on time and dress appropriately. Follow the dress code on your invitation and ask others for further guidance if you are still unsure. In the armed forces for example, ladies are usually required to have their shoulders covered for formal dinners.
Refrain from leaving the table during dinner. Table manners should be faultless; this really is the time to be on your best behaviour.
Be prepared for speeches, grace and toasts. Don't finish everything in your glass and find yourself with nothing to raise a toast with. If the National Anthem is played you should be upstanding, leaving your glass on the table until the end. If the Loyal Toast is offered simply stand and repeat 'The Queen' after the principal host. Speeches and port follow the toasts.
Top Tip: take your lead from those around you at each stage. Look particularly to the top table for when to sit down, start eating, leave the table etc.