Grain boundaries and impurity phases in YBa2Cu3O7−δ