How could we define passion in artificial intelligence?
An elementary approach to 'passion' would be to pre-assign different areas for the program to be 'passionate' about and associate different numeric 'drive strengths' with each (perhaps adaptively). Mechanisms of this sort were studied in Toby Tyrell's widely cited PhD thesis on 'Action Selection in Animals'

More recently, some more sophisticated AI architectures have been developed under the heading of 'Intrinsic Motivation'.

Here  is a link to a paper on the subject by Pierre-Yves Oudeyer, a leading expert in the field of Developmental Robotics.

With regard to the question "would this cause the machine to do a better job?", that would very much depend on how open-ended the architecture is:

It's clearly easier if, rather than having to spell everything out in detail to a machine, we can simply specify a problem at a high-level and let its own motivations cause it to explore promising avenues.

Conversely, if motivations are too open ended, it may well spend all its time doing the equivalent of 'doodling on its paper' (Hofstadter).

Hence, like people, the quality of the output will be a function of its internal dispositions and could be measured in the same way for a given task (e.g. quantitatively for scientific activities, qualatatively for the arts).