  Two closely related topics: higher order Bohr sets and higher order almost
automorphy are investigated in this paper. Both of them are related to
nilsystems.
  In the first part, the problem which can be viewed as the higher order
version of an old question concerning Bohr sets is studied: for any $d\in
{\mathbb N}$ does the collection of $\{n\in {\mathbb Z}: S\cap
(S-n)\cap\ldots\cap (S-dn)\neq \emptyset\}$ with $S$ syndetic coincide with
that of Nil$_d$ Bohr$_0$-sets? It is proved that Nil$_d$ Bohr$_0$-sets could be
characterized via generalized polynomials, and applying this result one side of
the problem is answered affirmatively: for any Nil$_d$ Bohr$_0$-set $A$, there
exists a syndetic set $S$ such that $A\supset \{n\in {\mathbb Z}: S\cap
(S-n)\cap\ldots\cap (S-dn)\neq \emptyset\}.$ Moreover, it is shown that the
answer of the other side of the problem can be deduced from some result by
Bergelson-Host-Kra if modulo a set with zero density.
  In the second part, the notion of $d$-step almost automorphic systems with
$d\in{\mathbb N}\cup\{\infty\}$ is introduced and investigated, which is the
generalization of the classical almost automorphic ones. It is worth to mention
that some results concerning higher order Bohr sets will be applied to the
investigation. For a minimal topological dynamical system $(X,T)$ it is shown
that the condition $x\in X$ is $d$-step almost automorphic can be characterized
via various subsets of ${\mathbb Z}$ including the dual sets of $d$-step
Poincar\'e and Birkhoff recurrence sets, and Nil$_d$ Bohr$_0$-sets. Moreover,
it turns out that the condition $(x,y)\in X\times X$ is regionally proximal of
order $d$ can also be characterized via various subsets of ${\mathbb Z}$.
