Focus is determined by buffs; positive buffs increase a Sim's Focus while negative buffs decrease it. The Focus effects from all the buffs a Sim is experiencing are added together and displayed on the Sim's Focus Meter. If a Hero sims Focus Meter is in the red while they're on a quest, Quest Performance will begin to suffer. Likewise, if their Focus Meter is high, Quest Performance will start to go up.
Focus affects the chance of success for a large number of actions and events, including dueling, crafting, gathering and quest tasks. Therefore, in general, it's important to keep a Sim focused by earning positive buffs and avoiding negative ones, though there are certain quests that may require low focus as a quest stage objective.