This is the code :
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\DrawRect}[3]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[#3] ([yshift=8pt,xshift=4pt]#1.north west) rectangle ([yshift=0pt,xshift=-4pt]#2.south east);
\end{tikzpicture}
}
\begin{document}
\begin{subequations}\label{1}
\begin{align}
&\tikzmark{Begin}A=B=C\label{a}\\
&D=E\tikzmark{End}=F\label{b}
\end{align}
\end{subequations}
\DrawRect{Begin}{End}{green}
\end{document}
And the output:

Edit for more complicated situations:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
\makeatletter
\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture] \node[xshift={\f@size/1.5},yshift={\f@size/3}] (#1) {\phantom{$#2$}};}
\makeatother
% #1 is the draw option (can contain decorate etc) #2 can be any shift option to be used for all points. #3 are the points in comma separated list.
\def\DrawComplic#1#2#3{
\begin{tikzpicture}[overlay,remember picture]
\draw[#1]\foreach \point[count=\i from 0] in {#3}{%
\ifnum\i=0 ([#2]\point) \else --([#2]\point)\fi%
}--cycle;
\end{tikzpicture}
}
\begin{document}
\begin{subequations}\label{1}
\begin{align}
f(x,y,z)&=\tikzmark{First}{A x}A x=B y=C z\label{a}\\
&=\tikzmark{Fourth}{D x}D x=\tikzmark{Third}{E y}E y=F z\label{b}\\
&=\tikzmark{Last}{F x}F x=G y\label{c}
\end{align}
\end{subequations}
\DrawComplic{red}{}{First.north west,First.north east,First.south east,Third.north east,Third.south east,Last.north east, Last.south east, Last.south west}
\end{document}
Output:

\tikzmarkbeforeAand another one afterEyou got it. – koleygr Sep 20 '17 at 19:50