Oil major BP beat earnings expectations on Tuesday, highlighting a surge in refining and trading during the final three months of 2017.