The reason
$$\int_{[a,b]} f(x)dx$$
is defined, is because integration is not limited to the "standard" Riemann or Lebesgue integration! Integrating over the reals is usually done using something called the Lebesgue measure $\lambda$, which (in very simple terms) measures the length of a set.
In particular, for an interval between $a$ and $b$, the Lebesgue measure is defined as $$\lambda([a,b]) = \lambda((a,b)) = \lambda([a,b)) = \lambda((a,b]) = b-a.$$
Since for this measure it doesn't matter if $a$ and $b$ are inside or outside the interval, we can write (without ambiguity)
$$\int_a^b f(x)dx.$$
In general, we define integration with respect to a measureable set $D$ and a measure $\mu$:
$$\int_D f \; d\mu$$
Without going into much detail what all of this is,
let me define another measure, the counting measure:
$$\tau: D \mapsto \left\{\begin{array}{ll}
|D| & \text{ if $D$ is a finite set}\\
\infty & \text{ if $D$ is an infinite set}
\end{array}\right.$$
Using this measure to integrate, an integral of a positive function $f$ can be evaluated as follows:
$$\int_D f \;d\tau = \left\{\begin{array}{ll}\sum\limits_{x \in D}f(x) & \text{ if $f$ has countable support}\\
+\infty & \text{ if $f$ has uncountable support }
\end{array}\right.$$
For example, take the indicator function
$$\chi_\mathbb{N}: \mathbb{R} \to \{0,1\}: x \mapsto \left\{\begin{array}{ll}1 & \text{ if } x \in \mathbb{N}\\
0 & \text{ if } x \notin \mathbb{N}\end{array}\right.$$
Then integrating over an interval can depend on the boundaries of said interval:
$$\begin{align}\int_{[2,3]}\chi_{\mathbb{N}}\; d\tau &= \sum\limits_{x \in [2,3]}\chi_{\mathbb{N}}(x) = 1 + 0 + 0 + \cdots + 0 + 1 = 2\\
\int_{(2,3)}\chi_{\mathbb{N}}\; d\tau &= \sum\limits_{x \in (2,3)}\chi_{\mathbb{N}}(x) = 0 + 0 + \cdots + 0 = 0\\
\int_{(2,3]}\chi_{\mathbb{N}}\; d\tau &= \sum\limits_{x \in (2,3]}\chi_{\mathbb{N}}(x) = 0 + 0 + \cdots + 0 +1= 1\\
\int_{[2,3)}\chi_{\mathbb{N}}\; d\tau &= \sum\limits_{x \in [2,3)}\chi_{\mathbb{N}}(x) = 1 + 0 + 0 + \cdots + 0 = 1\\
\end{align}$$
So in this case we need this notation, because the notation
$$\int_2^3 \chi_\mathbb{N} \;d\tau$$
would be ambiguous.