Equality definition In his book "Analysis 1", Terence Tao writes:

Thus, from the point of view of logic, we can define equality on
  a however we please, so long as it obeys the reflexive, symmetry,
  and transitive axioms, and it is consistent with all other operations
  on the class of objects under discussion in the sense that
  the substitution axiom was true for all of those operations.

So can one for example define that two functions $f, g\colon A\to B$ are equal if they agree almost everywhere? Intuitively, I would say that this contradicts the axiom of substitution: For example, consider the following functions of the type $\mathbb R\to\mathbb R$: $f(x) = x$ for all $x$ and $g(y) = y$ for every $y\not = 3$, $g(3) = 4$. Then we have $f=g$ because of our definition (there are only finitely many arguments on which the functions disagree (in fact there's only one: $3$), so they are equal). But by the axiom of substitution, the following should hold: $f(3) = g(3)$. Now I am a bit confused.

Tao is saying that you can define equality however you want as long as it is an equivalence relation and satisfies the axiom of substitution (for all the operations you have in a given context).  So since your definition does not satisfy the axiom of substitution (assuming you have evaluation at a point as one of your operations), it is not an appropriate definition of equality.
You could choose to define functions to be equal if they have the same value almost everywhere, but then what you've shown is that such "functions" cannot be evaluated at points.  That is, if you define equality in this way, then you can't define what "$f(3)$" means.  Usually we phrase this not in terms of defining "equality", but in terms of considering the set of equivalence classes with respect to an equivalence relation (namely, the relation of being the same almost everywhere).
