It has to do with change in oxidation number. If the oxidation number increases (becomes more positive) then oxidation has occurred but if it decreases (becomes more negative) then reduction has occurred. Compare carbon's oxidation number in methanol and methanoic acid: in methanol the C has an ox no. of -2 but in methanoic acid it is +2 so it has been oxidised by adding oxygen. If you reduced the methanoic acid to methanol by adding hydrogen the ox no changes from +2 to -2 which is reduction.