Turns out you can do this (sort of) using appearance attributes. The caveat is the lines of text have to be their own text elements rather than a character selection.
How to make the boxes
- Open the appearance panel, Window > Appearance
- Double click Characters to access the character appearance
- Set the Fill to your foreground color
- Click Type to get back to the text element
- Add New Fill (bottom left hand corner of the the panel)
- Set the new fill to your background color
- With the new Fill selected, Add New Effect > Convert to Shape > Rectangle...
- Set the Rectangle to whatever you want, as long as size is relative it will reflow to your text.
You should have something like this,

It also works accross lines,

Here's my appearance settings for the text elements. Note you may have to drag the Characters layer above the newly created Fill layer.

Pro Tip(s)
- You can save as a Graphic Style to apply it to any element and synchronise any changes you make to the style.
- You can do other cool effects with this like capsules using different shapes (e.g. Rounded Rectangle)
