As the first parameter to form_set_error()
, pass the name of the field to be highlighted. If it's a nested structure, pass it with square brackets, like so:
form_set_error('[your][nested][field]', 'Your Error Message');
There's a convenience wrapper around this, form_error
, which takes the element instead of the string, like so:
form_error($form['your_field'], 'Your Error Message');
Also see the docs to form_set_error()
(d7).