I don't know if you've already figured it out, but the <legend> tag basically defines a caption for a <fieldset> (set of fields in a form). You can see an example here of how it might be used. It helps visually group the fields together and helps for accessibility. This is what it might look like:
"Personalia" is the <legend> tag, and the rest are fields. It's grouped by <fieldset>.