It doesn't differ - this is just the subspace topology on $X$.
Given a topological space $A$ and a subset $B\subseteq A$, we can give $B$ the subspace topology.
Let us suppose $B$ is a closed subset of $A$.
Because we have made $B$ into a topological space via the subspace topology, we speak of subsets of $B$ being open or closed.
By the definition of the subspace topology, $C\subseteq B$ is open in $B$ if and only if there exists some $E\subseteq A$, that is open in $A$, such that $E\cap B = C$.
By the definition of "closed", the complement of $E$ in $A$, namely $A\setminus E$, is a closed subset of $A$.
Because $A\setminus E$ and $B$ are both closed subsets of $A$, their intersection $(A\setminus E)\cap B$ is also a closed subset of $A$.
Their intersection is equal to $B\setminus (B\cap E)=B\setminus C$.
Thus, $C\subseteq B$ is open in $B$ if and only if $B\setminus C$ is a closed subset of $A$.
In this case, $A=\mathbb{A}^n$ is affine space with the Zariski topology, $B=X$, and $C=U$.
In the quote from Shafarevich, at the end there appears "$X\setminus U$ is closed", which can be ambiguous when it is said without reference to which topological space it is closed in. However, it is implicitly being taken to mean in the big space, i.e. $A$.